<?php
namespace App\Model\Face;

use App\Model\Base;

class Department extends Base{
	public $tableName = "mymk_department";

	/**
	 * 通过条件获取数据库里面的部门数据和部门人数
	 * @auth   xiaozhi
	 * @param  array   $condition [description]
	 * @return [type]             [description]
	 */
	public function getFaceDepData($field = '*', $where = [], $order = ['A.id', 'desc']) {

		$this->withTotalCount()
		    ->field($field)
		    ->order($order[0], $order[1])
		    ->group('A.id')
		    ->alias('A')
			->join('mymk_face as B','find_in_set(A.id, B.departmentid) and B.status=1','LEFT')
			->where($where)
            ->all();
		
        $lists = $this->lastQueryResult()->getResult();

        // $list = $lastResult->getResult();
        return $lists;
	}

}